class code2{
    //这里不能用poll

    //有参数的remove方法，返回值类型为boolean

    Queue<int[]> q;

    public AnimalShelf() {
        q = new LinkedList<>();
    }

    public void enqueue(int[] animal) {
        q.offer(animal);
    }

    public int[] dequeueAny() {
        if(q.isEmpty()) {
            return new int[]{-1,-1};
        }
        return q.poll();
    }

    public int[] dequeueDog() {
        for(int[] x:q) {
            if(x[1] == 1) {
                q.remove(x);
                return x;
            }
        }
        return new int[]{-1,-1};
    }

    public int[] dequeueCat() {
        for(int[] x:q) {
            if(x[1] == 0) {
                q.remove(x);
                return x;
            }
        }
        return new int[]{-1,-1};
    }
}

/**
 * Your AnimalShelf object will be instantiated and called as such:
 * AnimalShelf obj = new AnimalShelf();
 * obj.enqueue(animal);
 * int[] param_2 = obj.dequeueAny();
 * int[] param_3 = obj.dequeueDog();
 * int[] param_4 = obj.dequeueCat();
 */